#include "home.h"

int main()
{
	int arr[] = {89,65,35,98,25,9,37,56,97};
	showArr(arr,sizeof(arr)/sizeof(int));
	//int* p;
	maopao(arr, sizeof(arr) / sizeof(int));
	showArr(arr, sizeof(arr) / sizeof(int));

	system("pause");
	return 0;
}

void maopao(int* p, int num)
{
	int temp = 0;
	for (int i = 1; i < num; i++)
	{
		for (int j = 0; j < num - i ; j++)
		{
			if (p[j] > p[j + 1])
			{
				temp = p[j];
				p[j] = p[j + 1];
				p[j + 1] = temp;
			}
		}
	}
}

void showArr(int* p,int num)
{
	for (int i = 0; i < num; i++)
	{
		cout << p[i] << " ";
	}
	cout << endl;
}